import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ThirdListingVO, ThirdListingForm, ThirdListingQuery } from '@/api/lingxing/thirdListing/types';

/**
 * 查询多平台Listing列表
 * @param query
 * @returns {*}
 */

export const listThirdListing = (query?: ThirdListingQuery): AxiosPromise<ThirdListingVO[]> => {
  return request({
    url: '/lingxing/thirdListing/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询多平台Listing详细
 * @param id
 */
export const getThirdListing = (id: string | number): AxiosPromise<ThirdListingVO> => {
  return request({
    url: '/lingxing/thirdListing/' + id,
    method: 'get'
  });
};

/**
 * 新增多平台Listing
 * @param data
 */
export const addThirdListing = (data: ThirdListingForm) => {
  return request({
    url: '/lingxing/thirdListing',
    method: 'post',
    data: data
  });
};

/**
 * 修改多平台Listing
 * @param data
 */
export const updateThirdListing = (data: ThirdListingForm) => {
  return request({
    url: '/lingxing/thirdListing',
    method: 'put',
    data: data
  });
};

/**
 * 删除多平台Listing
 * @param id
 */
export const delThirdListing = (id: string | number | Array<string | number>) => {
  return request({
    url: '/lingxing/thirdListing/' + id,
    method: 'delete'
  });
};


/**
 * 同步领星接口
 * @returns {*}
 */
export const syncData = (query?: ThirdListingQuery) => {
  return request({
    url: '/lingxing/thirdListing/syncData',
    method: 'post',
    data: query
  });
};